﻿using System.Drawing;
using System.IO;
using PlanningGIS.DataConvert.form;
using ESRI.ArcGIS.ADF.BaseClasses;
using System.Resources;
using PlanningGIS.Framework;

namespace PlanningGIS.DataConvert.button
{
    /// <summary>
    /// 矢量数据入库
    /// </summary>
    public class btnDlgDataImport : BaseCommand
    {
        /// <summary>
        ///作用：矢量数据入库按钮
        /// </summary>
        private FrmDlgDataImport m_frmDlgDataImport1 = null;

        /// <summary>
        /// 应用程序框架
        /// </summary>
        IApplication m_Application = null;

        /// <summary>
        /// 构造函数
        /// </summary>
        public btnDlgDataImport()
        {
            base.m_caption = "矢量数据入库";
            base.m_toolTip = base.m_caption;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hook"></param>
        public override void OnCreate(object hook)
        {
            m_Application = hook as IApplication;
        }

        /// <summary>
        /// 是否可用
        /// </summary>
        public override bool Enabled
        {
            get
            {
                return true;
            }
        }

        /// <summary>
        /// 点击事件
        /// </summary>
        public override void OnClick()
        {
            if (m_frmDlgDataImport1 == null || m_frmDlgDataImport1.IsDisposed)
            {
                m_frmDlgDataImport1 = new FrmDlgDataImport();
                m_frmDlgDataImport1.Show((m_Application as IFramework).MdiForm);
            }
            else
            {
                m_frmDlgDataImport1.BringToFront();
            }
        }

        /// <summary>
        /// 图标
        /// </summary>
        public override int Bitmap
        {
            get
            {
                string bitmapResourceName = "PlanningGIS.DataConvert.Res." + this.GetType().Name + ".png";
                return new Bitmap(GetType().Assembly.GetManifestResourceStream(bitmapResourceName)).GetHbitmap().ToInt32();
            }
        }

    }
}